package com.acme.task1;

/**
 * Class which calculates result of a binary operation.
 * @author belDser
 */
public class Calculator
{
	/**
	 * The main() method.
	 * @param args command line arguments
	 */
    public static void main(String[] args)
    {
    	if (args.length < 3)
    	{
    		System.out.println("Template: X op Y " + 
    				"(op = +, -, x, /)");
    		return;
    	}
    	
		double operand1 = Double.parseDouble(args[0]);
		double operand2 = Double.parseDouble(args[2]);
		
		switch (args[1].charAt(0))
		{
			case '+':
				System.out.println(operand1 + operand2);
				break;
			case '-':
				System.out.println(operand1 - operand2);
				break;
			case 'x':
				System.out.println(operand1 * operand2);
				break;
			case '/':
				System.out.println(operand1 / operand2);
				break;
			default:
				System.out.println("The 2nd operand must be " +
						"an operator (+, -, x, /)");
		}
	}
}